package com.liang.jiekou.controller;

import com.liang.jiekou.entity.Result;
import com.liang.jiekou.entity.dto.LldDto;
import com.liang.jiekou.service.MOCTCService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: LiangPanDeng
 * @Date: 2024/02/23/9:05
 * @Description:
 */
@RestController
@RequestMapping("/ltl")
@Api(tags = "领--退料单控制器")
@Resource
public class MOCTCController {
    @Resource
    private MOCTCService moctcService;

    @ApiOperation("领料单接口")
    @PostMapping("/add")
    public Result add(@RequestBody LldDto lldDto){
        Result result =  moctcService.add(lldDto);
        return result;
    }

    @ApiOperation("补料单接口")
    @PostMapping("/supplement")
    public Result supplement(@RequestBody LldDto lldDto){
        Result result =  moctcService.supplement(lldDto);
        return result;
    }

    @ApiOperation("退料入库单")
    @PostMapping("/refund")
    public Result refund(@RequestBody LldDto lldDto){
        Result result =  moctcService.refund(lldDto);
        return result;
    }

    @ApiOperation("撤销领料出库")
    @PostMapping("/revokeLld")
    public Result revokeLld(@RequestParam(value = "creator") String creator ,
                            @RequestParam(value = "db") String db ,
                            @RequestParam(value = "dh") String dh){
        Result result = moctcService.revokeLld(creator,db,dh);
        return  result;
    }

    @ApiOperation("撤销退料出库")
    @PostMapping("/revokeRefund")
    public Result revokeRefund(@RequestParam(value = "creator") String creator ,
                               @RequestParam(value = "db") String db ,
                               @RequestParam(value = "dh") String dh){
        Result result = moctcService.revokeRefund(creator,db,dh);
        return  result;
    }
}
